package com.scnu.hachimi.element;

import com.scnu.hachimi.manager.ResourcesManager;

import java.awt.*;

public class Boom extends ElementObject {
    public int life = 20;

    public Boom(String img, int x, int y, int width, int height) {
        super(img, x, y, width, height);
    }

    public void paintSelf(Graphics g, ResourcesManager rm) {
        g.drawImage(rm.imageMap.get(this.img), x, y, w, h, null);
    }

    public Rectangle getRect() {
        return new Rectangle(x, y, w, h);
    }

    public void move() {
        if (life % 2 == 0) {
            x -= 2;
            y -= 2;
            w += 4;
            h += 4;
        }
        life--;
    }
}
